home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 49 / Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso / -serious- / misc / football / exec / results.rexx < prev    next >
OS/2 REXX Batch file  |  1999-11-29  |  4KB  |  131 lines

  1. /* ***********************************************************************
  2.  
  3.    RESULTS PROGRAM FOR FOOTBALL REXX SUITE
  4.   ---------------------------------------
  5.                    Copyright  Mark Naughton 1996
  6.  
  7.  
  8. Version    Date     History
  9. --------------------------------------------------------------------------
  10.  1.0       270996   First release. Displays all results from 'Teams.sf'
  11.                     file.
  12.  1.1       121196   Updated to get arguments and to use '*.sflearn' to get
  13.                     a true display as '.sf' was in order. Now called as a
  14.                     component of FOOTBALL.
  15.            131196   Added checks for files - if not found, exits without
  16.                     a message.
  17.            211196   Updated and tidied the display.
  18.            190497   Added title to display.
  19.  1.2       060997   Amended to handle new Automatic Scheduling schedules.
  20.                     Removed - new program for this. Formatting needs to be
  21.                     handled properly.
  22.            151297   Tidied display.
  23.            180499   Improved match/fixture display.
  24.            310599   Changed to accommodate extra data in '.sflearn' file.
  25.            250899   Added error msg to file check.
  26.            270899   Converted to use locale. Some error messages, before
  27.                     reading the locale, will still be in English.
  28.  
  29. **************************************************************************
  30.  
  31. Procedure
  32. ---------
  33.  
  34. 1. Check files exist.
  35. 2. Open file and print all lines without '*' with the exception of
  36.    the league name which is underlined; possibly dates as well.
  37. 3. Close file and exit.
  38.  
  39. ************************************************************************** */
  40. parse arg league_file
  41.  
  42. version     = 1
  43. league_file = "Data/" || league_file
  44. input_file  = '.sflearn'
  45. separator   = '*'
  46. separator2  = '**'
  47.  
  48. addlib('rexxsupport.library',0,-30,0)
  49.  
  50. if open(datafile,"Data/Football.locale",'r') then do
  51.    line = readln(datafile)
  52.    locdir = strip(line)
  53.    close(datafile)
  54. end
  55. else do
  56.    say
  57.    say "ERROR :    (Results)"
  58.    say
  59.    say "Cannot read 'Data/Football.locale' for the locale settings."
  60.    exit
  61. end
  62.  
  63. locdir = locdir"Exec/Results.data"
  64.  
  65. if open(datafile,"ENV:FootballRXPath",'r') then do
  66.    line = readln(datafile)
  67.    rxdir = strip(line)
  68.    close(datafile)
  69. end
  70. else
  71.    rxdir = "SYS:Rexxc/"
  72.  
  73. if exists(locdir) > 0 then do
  74.   address command rxdir'rx 'locdir
  75.   VarCount = getclip('VarCount')
  76.   do i = 1 to VarCount
  77.     interpret getclip('var.'i)
  78.   end
  79. end
  80. else do
  81.    say
  82.    say "ERROR :    (Results)"
  83.    say
  84.    say "Cannot find '"locdir"' to read locale settings."
  85.    exit
  86. end
  87.  
  88. if exists(league_file || input_file) = 0  then do
  89.    say
  90.    say rs_error
  91.    say
  92.    say rs_one"'"league_file||input_file"'."
  93.    exit
  94. end
  95.  
  96. if open(datafile,league_file || input_file,'r') then do
  97.    say
  98.    say center(rs_four,78)
  99.    say "-------------------------------------------------------------------------------"
  100.    say
  101.    do while ~eof(datafile)
  102.       line = readln(datafile)
  103.       if pos(separator,line) = 0 then do
  104.          t1 = right(strip(substr(line,1,30)),30,' ')
  105.          say t1||substr(line,31)
  106.       end
  107.       else do
  108.          if pos(separator2,line) > 0 then do
  109.             say subword(line,2)
  110.             uline = ''
  111.             do i=1 to length(subword(line,2))
  112.                uline = insert('-',uline,i,1)
  113.             end
  114.             say strip(uline)
  115.          end
  116.          else
  117.             if line = separator then
  118.                say
  119.       end
  120.    end
  121.    say "-------------------------------------------------------------------------------"
  122.    close(datafile)
  123. end
  124. else do
  125.    say
  126.    say rs_error
  127.    say
  128.    say rs_two"'"league_file||input_file"'"rs_three
  129. end
  130.  
  131. exit